/**
 * Created by Administrator on 2016/8/9.
 */
$(function(){
    postArray.team_id =getQueryString("team_id");
    $.post(commonval+"/team_data",postArray,function(data){
        if(data.status == 1){
            var $width = $(window).width();
            var pWidth = $("header p").css("width");
            pWidth = parseInt(pWidth);
            $("header p").css("margin-left",($width-pWidth)/2-50);
            Vue.filter('wrap', function (value) {
                if(value.length>60){
                    return value.substr(0, 60)+"…";
                }else{
                    return value;
                }
            })
            var info = data.data.info;
            var name =data.data.teamname;
            $("header p").text(name);
            var shortInfo =info.substr(0, 60)+"…";
            var docListMember = new Vue({
                el: '#doctorIntro1',
                data: data.data
            });
            var docListMember = new Vue({
                el: '#docListMember',
                data: {
                    items: data.data.team_doctor
                }
            });
            var i = 0;
            var j = 0;
            $('#doctorIntro1 .shortInfo:first-child').on('click', function () {
                    i++;
                    setTimeout(function () {
                        i = 0;
                    }, 500);
                    if(j%2 ==0){
                        if (i > 1) {
                            $(this).children("p:nth-child(2)").children("span").text(data.data.info);
                            $(this).children("p:nth-child(2)").children("img").attr("src","../images/unfold.png")
                            i = 0;
                            j++;
                        }
                    }else{
                        if (i > 1) {
                            $(this).children("p:nth-child(2)").children("span").text(shortInfo);
                            $(this).children("p:nth-child(2)").children("img").attr("src","../images/fold.png")
                            i = 0;
                            j++;
                        }
                    }
            })
            $("#doctorIntro1").css("display","block")
            $("#docListMember").css("display","block")
            $(".banner").attr("src",data.data.img);
        }
    })
})